package com.zbkj.admin.controller.platform.assistant;

import com.zbkj.admin.controller.platform.assistant.service.AssistantSettingService;
import com.zbkj.common.model.assistant.AssistantSetting;
import com.zbkj.common.result.CommonResult;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * 客服设置 前端控制器
 */
@Slf4j
@RestController
@RequestMapping("api/admin/platform/assistant/setting")
@Api(tags = "客服-设置") //配合swagger使用

public class AssistantSettingController {

    @Autowired
    private AssistantSettingService assistantSettingService;

    @ApiOperation(value = "更新客服设置")
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public CommonResult<String> save(@RequestBody @Validated AssistantSetting request) {
        assistantSettingService.update(request);
        return CommonResult.success();
    }

    @ApiOperation(value = "查询客服设置信息")
    @RequestMapping(value = "/info", method = RequestMethod.GET)
    public CommonResult<AssistantSetting> info() {
        AssistantSetting assistantSetting = assistantSettingService.getSetting();
        return CommonResult.success(assistantSetting);
    }
}



